#pragma once
#include <myFs/FSbasic.h>
namespace myFs {
namespace basic {
using size_t = uint32_t;

class SimpleFShelper {
  public:
    ~SimpleFShelper();
    SimpleFShelper(::std::string str = "dumpfile");

  public:
    int    openHelper(size_t inum);
    int    writeHelper(size_t inum, char const* buf, size_t size, size_t off);
    int    readHelper(size_t inum, char* buf, size_t size, off_t off);
    int    renameHelper(size_t pinum1, size_t inum1, size_t pinum2, std::string const& name2);
    int    rmdirHelper(size_t inum);
    size_t mkdirHelper(size_t inum, std::string const& filename);
    size_t mknodHelper(size_t inum, std::string const& filename);
    int    getattrHelper(size_t inum, Inode& inode);
    int    readdirHelper(size_t inum, std::vector<DirEntry>& dir);
    int    unlinkHelper(size_t parentInum, size_t inum);
    int    releasedirHelper(size_t inum);

    size_t toInum(std::string const& path);
    void   removeDirEntry(size_t pinum, size_t inum);
    void   addDirEntry(size_t pinum, DirEntry const& de);

  private:
    FSbasic m_fsbasic;
};
}  // namespace basic
}  // namespace myFs